package conf

type Mysql struct {
	Port        string `yaml:"port"`
	Host        string `yaml:"host"`
	DbName      string `yaml:"db-name" mapstructure:"db-name"`
	Username    string `yaml:"username"`
	Password    string `yaml:"password"`
	Prefix      string `yaml:"prefix"`
	Singular    bool   `yaml:"singular"`
	MaxIdleConn int    `mapstructure:"max-idle-conn"`
	MaxOpenConn int    `mapstructure:"max-open-conn"`
}

func (m *Mysql) Dsn() string {
	return m.Username + ":" + m.Password + "@tcp(" + m.Host + ":" + m.Port + ")/" + m.DbName + "?" + "parseTime=true" + "&loc=Local"
}
